$OpenBSD: patch-configure,v 1.3 2008/01/30 20:41:41 okan Exp $
--- configure.orig	Fri Jan 25 18:00:17 2008
+++ configure	Fri Jan 25 18:04:47 2008
@@ -198,15 +198,17 @@ sub with_pgsql {
 	print "checking for pgsql... ";
 	
 	if ($value) { 
-		if (! -e "$value/include/pgsql/postgres.h") {
-			print "Error! $value/include/pgsql/postgres.h not found\n";
+		my $libpq = "$value/lib/libpq.so";
+
+		if (! -e "$value/include/postgresql/postgres_ext.h") {
+			print "Error! $value/include/postgresql/postgres_ext.h not found\n";
 			exit 1;
 		}
-		if (! -e "$value/lib/libpq.so") {
+		if (! grep /^$libpq(\.\d+){0,3}/, <$libpq.*>) {
 			print "Error! $value/lib/libpq.so not found\n";
 			exit 1;
 		}
-		$INC .= " -I$value/include/pgsql/ ";
+		$INC .= " -I$value/include/postgresql/ ";
 		$LIB .= " -L$value/lib/ -lpq ";
 		$DEF .= " -DPGSQL_ENABLED ";
 		print "found\n";
@@ -511,7 +513,7 @@ PREOP = @$(NOOP)
 POSTOP = @$(NOOP)
 TO_UNIX = @$(NOOP)
 
-AINCLUDEDIR=-I`$(APXS) -q INCLUDEDIR` `$(APXS) -q CFLAGS`
+AINCLUDEDIR=-I`$(APXS) -q INCLUDEDIR` `$(APXS) -q CFLAGS CFLAGS_SHLIB`
 ACFLAGS=-I`$(APXS) -q INCLUDEDIR`
 LD_SHLIB=`$(APXS) -q LDFLAGS_SHLIB`
 CC=`$(APXS) -q CC`
